import Model from './index';

export default class User extends Model {
	
    format(row, isFromCache) {
      this.id = row.userID.toString();
      this.name = row.userName;
      if(this.name.indexOf('...') != -1) {
        const positionPieces = _.split(_.split(this.name, '...')[0], '/');
        if(positionPieces && positionPieces.length) {
          this.name = `${positionPieces[0]}【${positionPieces[1]}】`;
        }
      } else if(this.name.indexOf('/') != -1) {
        const positionPieces = _.split(this.name, '/');
        if(positionPieces && positionPieces.length) {
          this.name = positionPieces[0];
        }
      }
      if(row.representPositionID) {
        this.representPositionId = row.representPositionID;
      }
    }
}
User.typeName = 'User';
User.displayName = '用户';